/**
 * 功能描述
 */

define(function (require, exports, module) {
    var business = {
        checkInStatus: function (row,statusA,statusB) {
        	var status = row.roomPersonalInfos;
			var check = 0;
			if(status.length){
				for(var i=0;i<status.length;i++){
					if(!status[i].checkIn){
						check+= 1;
					}
				}
				if(check){
					return statusA;
				}else{
					return statusB;
				}
			}else{
				return "";
			}
        },
    	nonMenberStatus:function(row,Experience,TravelGroup,Individual,IndivMember,nonTravelGroup,nonIndividual,nonIndivMember){
    		var signUpType = row.nonMemGroupReserve.nonMemberGroup.signUpType,
    			sourceType = row.nonMemGroupReserve.nonMemberGroup.sourceType,
    			tourType = row.nonMemGroupReserve.nonMemberGroup.tourType;
			if(signUpType && signUpType.key == "Experience"){
				return Experience;
			}else if(signUpType && signUpType.key == "NonMember"){
				if(sourceType && sourceType.key == "Reservation"){
					if(tourType && tourType.key == "TravelGroup"){
						return TravelGroup;
					}else if(tourType && tourType.key == "Individual"){
						return Individual;
					}else if(tourType && tourType.key == "IndivMember"){
						return IndivMember;
					}
				}else if(sourceType && sourceType.key == "DropIn"){
					if(tourType && tourType.key == "TravelGroup"){
						return nonTravelGroup;
					}else if(tourType && tourType.key == "Individual"){
						return nonIndividual;
					}else if(tourType && tourType.key == "IndivMember"){
						return nonIndivMember;
					}
				}
			}		
    	},
    	nonMemberTypeS:function(row,widget){
    		var form = widget.get("form");
    		var signUpType = form.getValue("signUpType"),
				sourceType = form.getValue("sourceType");
    		var nonMemberType = false;
			if(signUpType == "Experience"){
				nonMemberType = true;
			}else if(signUpType == "NonMember"){
				if(sourceType == "Reservation"){
					nonMemberType = true;
				}else if(sourceType == "DropIn"){
					nonMemberType = false;
				}
			}
			return nonMemberType;
    	},
    	roomPrice:function(priceLen){
    		var Items = [];
    		for(var j=0;j<priceLen;j++){
				Items = Items.concat([{
					name: "price",
					label: "房价" + (j+1),
					readonly: true
				},{
					name:"linvePrice",
					label:"入住价" + (j+1),
					exValidate: function(value) {
                        var reg = /^[0-9]*[1-9][0-9]*$/;
                        if (!reg.test(value)) {
                        	form.setValue("priceSum", ""); 
                            return "不可输入0，负数，小数，特殊字符，汉字";
                        } else {
                            return true;
                        }
                    },
				},{
					name:"dinner",
					type: "checkbox",
					label:"",
					list: [{
		                key: "true",
		                value: "是否含三餐"
		            }]
				},{
					name:"breakfast",
					type: "checkbox",
					label:"",
					list: [{
		                key: "true",
		                value: "是否含三餐"
		            }]
				}])
    		}
    		return Items;
    	}
    };

    module.exports = business;
});
